import { RouteComponentProps } from 'react-router'
import Loadable from 'react-loadable'
import LoadingComponent from './loadingComponent'

// const Index = loadable(() => import('../pages/index'));
// const Login = loadable(() => import('../pages/login'));

const asyncComponent = (path: string) => {
    return Loadable({
        loader: () => import(path),
        loading: LoadingComponent
    })
}

export interface RouteConfigProps {
    path: string,
    exact: boolean,
    component: React.ComponentType<RouteComponentProps<any>> | React.ComponentType<any>,
    id?: number,
    name?: string,
    routes?: Array<RouteConfigProps>
}

export const routeConfig: Array<RouteConfigProps> = [
    // {
    //   path: '/login',
    //   exact: true,
    //   component: asyncComponent('../pages/index'),
    //   id: 1,
    //   name: '登陆',
    //   routes: []
    // },
  ]